package com.lg.happyfarmer.bean;

import org.json.JSONException;
import org.json.JSONObject;

import xtom.frame.XtomObject;
import xtom.frame.exception.DataParseException;

/**
 * 系统初始化信息
 */
public class SysInitInfo extends XtomObject {

	private String sys_web_service;// 后台服务根路径(含版本号)	
	//形如： http://192.168.2.146:8008/group1/hm_zlg/index.php/Webservice/V100/
	//说明：V100是服务器转换处理后的版本号，V100 对应客户端版本是1.0.0
	private String sys_plugins;// 第三方插件根路径	
	//形如： http://192.168.2.146:8008/group1/hm_zlg/plugins/
	private String start_img;// 启动页图片地址	形如：http://124.128.23.74:8008/group1/hm_php/uploadfiles/2015/03/201503041004513954.png
	private String android_must_update;// 安卓强制更新标记	
	//0：不强制 1：强制
	//（当软件架构进行了较大变动，客户端必须强制用户升级到最新版本）
	private String android_last_version;// 安卓最新版本号	将该信息与安卓本机版本号比对，如果不相等，则提醒在线升级
	private String sys_chat_ip;// 聊天服务器IP地址	形如：192.168.2.146
	private String sys_chat_port;// 聊天服务器端口号	形如：5222（一个整数）
	private String sys_pagesize;// 系统规定单页记录数	此参数在系统列表分页时需要用到，默认：20
	private String sys_service_phone;// 我公司统一客服电话	前台客服解疑释惑专用，目前是"0531-67804172"
	private String android_update_url;// 安卓软件更新地址	
	//类似 http://192.168.2.146:8008/group1/hm_zlg/download/yourprojectname.apk
	private String msg_invite;// 邀请下载短信内容	邀请大家安装软件!
	private String welcome_content;//软件打开首页时的欢迎语

	public SysInitInfo(JSONObject jsonObject) throws DataParseException {
		if (jsonObject != null) {
			try {
				sys_web_service = get(jsonObject, "sys_web_service");
				sys_plugins = get(jsonObject, "sys_plugins");
				start_img = get(jsonObject, "start_img");
				android_must_update = get(jsonObject, "android_must_update");
				android_last_version = get(jsonObject, "android_last_version");
				sys_chat_ip = get(jsonObject, "sys_chat_ip");
				sys_chat_port = get(jsonObject, "sys_chat_port");
				sys_pagesize = get(jsonObject, "sys_pagesize");
				sys_service_phone = get(jsonObject, "sys_service_phone");
				android_update_url = get(jsonObject, "android_update_url");
				msg_invite = get(jsonObject, "msg_invite");
                welcome_content = get(jsonObject, "welcome_content");
			} catch (JSONException e) {
				throw new DataParseException(e);
			}
		}
	}

	public SysInitInfo(String sys_web_service
			, String sys_plugins
			, String start_img
			, String android_must_update
			, String android_last_version
			, String sys_chat_ip
			, String sys_chat_port
			, String sys_pagesize
			, String sys_service_phone
			, String android_update_url
			, String msg_invite
            , String welcome_content) {
		super();
		this.sys_web_service = sys_web_service;
		this.sys_plugins = sys_plugins;
		this.start_img = start_img;
		this.android_must_update = android_must_update;
		this.android_last_version = android_last_version;
		this.sys_chat_ip = sys_chat_ip;
		this.sys_chat_port = sys_chat_port;
		this.sys_pagesize = sys_pagesize;
		this.sys_service_phone = sys_service_phone;
		this.android_update_url = android_update_url;
		this.msg_invite = msg_invite;
        this.welcome_content = welcome_content;
	}

	public String getSys_web_service() {
		return sys_web_service;
	}

	public String getSys_plugins() {
		return sys_plugins;
	}

	public String getStart_img() {
		return start_img;
	}

	public String getSys_must_update() {
		return android_must_update;
	}

	public String getSys_last_version() {
		return android_last_version;
	}
	
	public String getSys_chat_ip() {
		return sys_chat_ip;
	}

	public String getSys_chat_port() {
		return sys_chat_port;
	}

	public int getSys_pagesize() {
		return Integer.parseInt(sys_pagesize);
	}
	
	public String getSys_service_phone() {
		return sys_service_phone;
	}

	public String getAndroid_update_url() {
		return android_update_url;
	}

	public String getMsg_invite() {
		return msg_invite;
	}

    public String getWelcome_content() {
        return welcome_content;
    }
}
